bh<!DOCTYPE html>
<html>
<head>
 <link rel="icon" href="D:\icon.ico" type="image/x-icon">
    <title>Programming-C++</title>
</head>
<body>
<label for="userInput">Please enter a title for your article:</label>
<input type="text" id="userInput" placeholder="*Title of the article">
<button onclick="saveInput()">upload</button>
<button onclick="clearHistory()">Clear history</button>
 
<h2>C++ Files</h2>
<ul id="historyList"></ul>

<script>
window.onload = function() {
    displayHistory();
};
 
function saveInput() {
    const input = document.getElementById('userInput');
    const inputValue = input.value.trim();
    if (inputValue) {
        const history = JSON.parse(localStorage.getItem('history') || '[]');
        if (!history.includes(inputValue)) {
            history.unshift(inputValue); 
            localStorage.setItem('history', JSON.stringify(history));
            displayHistory();
        }
        input.value = '';
    }
}
 
function clearHistory() {
    localStorage.removeItem('history');
    const historyList = document.getElementById('historyList');
    historyList.innerHTML = '';
}
 
function displayHistory() {
    const history = JSON.parse(localStorage.getItem('history') || '[]');
    const historyList = document.getElementById('historyList');
    historyList.innerHTML = '';
    history.forEach(item => {
        const li = document.createElement('li');
        li.textContent = item;
        historyList.appendChild(li);
    });
}
</script>
<body oncontextmenu=self.event.returnValue=false onselectstart="return false">
<script type="text/javascript">
        window.onload = function(){
            document.onkeydown = function (){
                var e = window.event || arguments[0];
                if(e.keyCode == 123){
                    return false;
                }else if((e.ctrlKey) && (e.shiftKey) && (e.keyCode == 73)){
                    return false;
                }else if((e.shiftKey) && (e.keyCode == 121)){
                    return false;
                }else if((e.ctrlKey) && (e.keyCode == 85)){
                    return false;
                }
            };
            document.oncontextmenu = function (){
                return false;
            }
        }

    </script>
</body>
</html>